<?php
class my_custom_model extends CI_Model
{
	
public function list_fourn_per_article($id_article)
	{
		
	$this->db->query("DROP TABLE IF EXISTS my_temp_table");

	$str_q = "CREATE TABLE IF NOT EXISTS my_temp_table (SELECT
	articles.id_article,
	articles.nom,
	articles.`code`,
	articles.solde,
	articles.id_chapitre_fk
	FROM
	articles
	INNER JOIN chapitres ON articles.id_chapitre_fk = chapitres.id_chapitre
	WHERE
	chapitres.id_chapitre =$id_article)";

	$q=$this->db->query($str_q); 
	
	}
	
	
	public function get_all($id_article)
	{
	$q = $this->db->query("SELECT
fournisseurs.id_fournisseur,
fournisseurs.nom,
fournisseurs.adresse,
fournisseurs.tel,
fournisseurs.id_wilaya_fk,
fournisseurs.id_convetion_fk,
fournisseurs.comments,
conventions.id_convetion,
articles.nom
FROM
fournisseurs
INNER JOIN conventions ON fournisseurs.id_convetion_fk = conventions.id_convetion
INNER JOIN articles ON conventions.id_article_fk = articles.id_article
WHERE
articles.id_article = $id_article
");
	return $q->result();		
	}
	
	
	public function clr_list_fourn_per_article()
	{
		$this->db->query("DROP TABLE IF EXISTS my_temp_table");
	}
	
}


?>